(function (_super) {
    function Counter() {
        Counter.super(this);

        this.totalTime = 5;
        this.completeHandler = null;

        this.init();
    }
    Laya.class(Counter, "Com.Waiting.Counter", _super);
    var _proto = Counter.prototype;
    _proto.destroy = function () {
        _super.prototype.destroy.call(this, true);

        this.totalTime = null;
        this.completeHandler = null;
    }

    _proto.init = function () {
        this.size(110, 100);
        this.centerX = 0;
        this.y = 275;
        this.visible = false;
    }
    _proto.loop = function () {
        this.totalTime--;
        if(this.totalTime <= 0){
            Laya.timer.clearAll(this);
            
            this.visible = false;
        }

        this.timer.text = this.totalTime;
    }

    _proto.count = function () {
        this.visible = true;
        this.countAni.play(0, true);
        this.loop();
        Laya.timer.loop(1000, this, this.loop);
    }
})(ui.Waiting.CounterUI);